package com.twoGroup.boot.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName
 * @Description TODO
 * @Author Xuyujie
 * @Date 2021/5/20 15:34
 * @Version 1.0
 **/
public class MerchantUtils {

    /**
     * @Author Xuyujie
     * @Description //通过正则表达式验证参数的合法性
     * @Date 15:38 2021/5/20
     * @Param [param, expression]
     * @return boolean
     **/
    public static boolean ParamJudgeByRegular(String param, String expression){

        if(param.matches(expression)){
            return true;
        }else{
            return false;
        }
    }
    public static boolean isNumeric(String str){
        Pattern pattern = Pattern.compile("[0-9]*");
        Matcher isNum = pattern.matcher(str);
        if( !isNum.matches() ){
            return false;
        }
        return true;
    }
    public static boolean judgeLength(String str, int length){
        if(str.length()>0&&str.length()<=10){
            return true;
        }else{
            return false;
        }
    }


}
